package de.mnit.basis.swt.element.menue;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;

import de.mnit.basis.swt.element.A_SWT_Element;
import de.mnit.basis.swt.element.feld.menue.SWT_MenueFeld;
import de.mnit.basis.swt.element.feld.menue.SWT_MenueFeldAuswahl;
import de.mnit.basis.swt.element.feld.menue.SWT_MenueFeldCheck;
import de.mnit.basis.swt.element.feld.menue.SWT_MenueTrenner;
import de.mnit.basis.swt.grafik.S_SWT_Hat_Bild;

public abstract class A_SWT_Menue<TA extends A_SWT_Menue<?,?>, TB extends Menu> extends A_SWT_Element<TA,TB> {

	// EVENTS

	public void eZeigen(Listener l) {
		swt().addListener(SWT.Show, l);
	}

	public void eAusblenden(Listener l) {
		swt().addListener(SWT.Hide, l);
	}

	// NEU

	public SWT_MenueDropDown nMenueDropDown(String text) {
		SWT_MenueDropDown m=new SWT_MenueDropDown(text);
		m.erzeugeSWT(this.swt());
		return m;
	}

	public SWT_MenueFeld nMenueFeld(String text) {
		return nMenueFeld(text, null, null);
	}

	public SWT_MenueFeld nMenueFeld(String text, String hotkey, S_SWT_Hat_Bild bild) {
		SWT_MenueFeld m=new SWT_MenueFeld(text);
		m.erzeugeSWT(this.swt());
		if(hotkey!=null)
			m.sHotKey(hotkey);
		if(bild!=null)
			m.sBild(bild);
		return m;
	}

	public SWT_MenueFeldCheck nMenueFeldCheck(String text) {
		SWT_MenueFeldCheck m=new SWT_MenueFeldCheck(text);
		m.erzeugeSWT(this.swt());
		return m;
	}

	public SWT_MenueFeldAuswahl nMenueFeldAuswahl(String text) {
		SWT_MenueFeldAuswahl m=new SWT_MenueFeldAuswahl(text);
		m.erzeugeSWT(this.swt());
		return m;
	}

	public SWT_MenueTrenner nMenueTrenner() {
		SWT_MenueTrenner m=new SWT_MenueTrenner();
		m.erzeugeSWT(this.swt());
		return m;
	}

	// ERZEUGEN

	protected final int style2()   { return style3(); }
	protected abstract int style3();

	protected final void init2()   {  init3(); }
	protected abstract void init3();

}
